package gui;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;

import java.awt.Panel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.FlowLayout;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
import javax.swing.BoxLayout;
import java.awt.CardLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import net.miginfocom.swing.MigLayout;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.factories.FormFactory;
import com.jgoodies.forms.layout.RowSpec;
import javax.swing.JTextField;
import java.awt.Insets;
import java.awt.Dimension;
import java.awt.Rectangle;
import javax.swing.ImageIcon;

public class ContaGUI extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTextField txDescr;
	private JTextField txVencimento;
	private JTextField txValor;
	private JTextField txMulta;
	private JTextField txJuros;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					ContaGUI frame = new ContaGUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public ContaGUI() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 592, 419);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(5, 5));
		setContentPane(contentPane);
		
		Panel panel = new Panel();
		contentPane.add(panel, BorderLayout.NORTH);
		panel.setLayout(new BorderLayout(0, 0));
		
		JLabel lblCadastroDeContas = new JLabel("Cadastro de Contas");
		lblCadastroDeContas.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		lblCadastroDeContas.setHorizontalAlignment(SwingConstants.CENTER);
		lblCadastroDeContas.setFont(new Font("Nimbus Sans L", Font.BOLD, 20));
		panel.add(lblCadastroDeContas, BorderLayout.NORTH);
		
		Panel panel_1 = new Panel();
		contentPane.add(panel_1, BorderLayout.CENTER);
		panel_1.setLayout(null);
		
		JLabel lblDescrio = new JLabel("Descrição:");
		lblDescrio.setBounds(6, 8, 74, 15);
		panel_1.add(lblDescrio);
		
		txDescr = new JTextField();
		txDescr.setSize(new Dimension(30, 0));
		txDescr.setBounds(100, 6, 342, 19);
		txDescr.setColumns(30);
		panel_1.add(txDescr);
		
		JLabel lblValor = new JLabel("Valor:");
		lblValor.setBounds(6, 33, 42, 15);
		panel_1.add(lblValor);
		
		txValor = new JTextField();
		txValor.setBounds(100, 31, 153, 19);
		txValor.setColumns(10);
		panel_1.add(txValor);
		
		JLabel lblNewLabel = new JLabel("Vencimento:");
		lblNewLabel.setBounds(6, 58, 88, 15);
		panel_1.add(lblNewLabel);
		
		txVencimento = new JTextField();
		txVencimento.setBounds(100, 56, 153, 19);
		txVencimento.setColumns(10);
		panel_1.add(txVencimento);
		
		JLabel lblMulta = new JLabel("Multa:");
		lblMulta.setBounds(6, 83, 45, 15);
		panel_1.add(lblMulta);
		
		txMulta = new JTextField();
		txMulta.setBounds(100, 81, 153, 19);
		txMulta.setColumns(10);
		panel_1.add(txMulta);
		
		JLabel lblJuros = new JLabel("Juros:");
		lblJuros.setBounds(6, 108, 41, 15);
		panel_1.add(lblJuros);
		
		txJuros = new JTextField();
		txJuros.setBounds(100, 106, 153, 19);
		txJuros.setColumns(10);
		panel_1.add(txJuros);
		
		Panel panel_2 = new Panel();
		contentPane.add(panel_2, BorderLayout.EAST);
		panel_2.setLayout(new BorderLayout(0, 0));
		
		JPanel panel_3 = new JPanel();
		panel_3.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		GridBagLayout gbl_panel_3 = new GridBagLayout();
		gbl_panel_3.columnWidths = new int[] {81};
		gbl_panel_3.rowHeights = new int[]{25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gbl_panel_3.columnWeights = new double[]{0.0};
		gbl_panel_3.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		panel_3.setLayout(gbl_panel_3);
		
		JButton btnGravar = new JButton("Gravar");
		btnGravar.setIcon(new ImageIcon(ContaGUI.class.getResource("/gui/Gnome-Media-Floppy-32.png")));
		btnGravar.setPreferredSize(new Dimension(120, 50));
		GridBagConstraints gbc_btnGravar = new GridBagConstraints();
		gbc_btnGravar.fill = GridBagConstraints.BOTH;
		gbc_btnGravar.insets = new Insets(0, 0, 5, 0);
		gbc_btnGravar.gridx = 0;
		gbc_btnGravar.gridy = 0;
		panel_3.add(btnGravar, gbc_btnGravar);
		panel_2.add(panel_3);
		
		JButton btCancelar = new JButton("Cancelar");
		btCancelar.setIcon(new ImageIcon(ContaGUI.class.getResource("/gui/Gnome-Process-Stop-32.png")));
		btCancelar.setPreferredSize(new Dimension(120, 50));
		GridBagConstraints gbc_btCancelar = new GridBagConstraints();
		gbc_btCancelar.fill = GridBagConstraints.BOTH;
		gbc_btCancelar.insets = new Insets(0, 0, 5, 0);
		gbc_btCancelar.gridx = 0;
		gbc_btCancelar.gridy = 1;
		panel_3.add(btCancelar, gbc_btCancelar);
		
		JButton btSair = new JButton("Sair");
		btSair.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				dispose();
			}
		});
		btSair.setIcon(new ImageIcon(ContaGUI.class.getResource("/gui/Gnome-Application-Exit-32.png")));
		btSair.setPreferredSize(new Dimension(120, 50));
		GridBagConstraints gbc_btSair = new GridBagConstraints();
		gbc_btSair.insets = new Insets(0, 0, 5, 0);
		gbc_btSair.fill = GridBagConstraints.BOTH;
		gbc_btSair.gridx = 0;
		gbc_btSair.gridy = 2;
		panel_3.add(btSair, gbc_btSair);
		btCancelar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				txDescr.setText("");
				txJuros.setText("");
				txMulta.setText("");
				txValor.setText("");
				txVencimento.setText("");
				dispose();
			}
		});
	}

}
